home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
px141.zip
/
PX.DOC
< prev
next >
Wrap
Text File
|
1991-05-19
|
8KB
|
208 lines
PX
Pascal Source Cross Referencer - Version 1.4
Copyright (c)1989,1991 by P.A. Geelen, Amsterdam
The program PX.EXE and this document are placed in the
public domain by the author. It may be used and distributed freely.
It may not be sold under any condition,
nor be made part of anything that is sold.
PX is a program specialized in cross-referencing PASCAL programs.
It will cross-reference:
- procedures and functions, their declarations and usage
- procedure/function calls
- variable declarations and usage
The output is best shown by a small example.
There are several options for the use of PX, but the most extensive
output will be generated using
PX /v
Suppose we have the following program, EXAMPLE.PAS
(the line numbers are depicted for convenience only):
1. var i,j:integer;
2.
3. procedure SubProc;
4. var x,y,z:integer;
5. procedure EvenSmallerProc(i);
6. var z:integer;
7. begin x:=i+j+y+z; end;
8. begin {SubProc}
9. x:=i; EvenSmallerProc(x);
10. end; {SubProc}
11.
12. begin
13. i:=5; j:=i;
14. writeln(i,' ',j);
15. repeat SubProc until keypressed;
16. end.
The output of "PX /V" would then be:
C:\MY\UTIL\EXAMPLE.PAS
Procedure Cross Reference 1.4 - P.A.Geelen, Amsterdam, 1989,1991
MAIN program [1-16]
vars : I [1].......................14,13,13,*9,
J [1].......................14,13,*7,
*KEYPRESSED <external>.......15,
uses : subproc.....................15,
SUBPROC procedure [3-10]
vars :*I [main:1]..................9,
X [4].......................9,9,*7,
Y [4].......................*7,
Z [4].......................
parts: EVENSMALLERPROC,
used : main........................15,
uses : evensmallerproc\subproc.....9,
EVENSMALLERPROC procedure [5-7]
in : \subproc
vars : I [5].......................7,
*J [main:1]..................7,
*X [subproc:4]...............7,
*Y [subproc:4]...............7,
Z [6].......................7,
used : subproc.....................9,
The meaning is as follows:
MAIN program [1-16]
VARS: I [1].......................14,13,13,*9,
J [1].......................14,13,*7,
*KEYPRESSED <external>.......15,
uses: subproc.....................15,
means that
- your main program spans lines 1-16.
- It uses the identifiers I,J, and KEYPRESSED.
- I is declared at line #1, and used on lines 14, 13 (twice) and 9.
The star before 9 means that I is used there from WITHIN ANOTHER
FUNTION or procedure (procedure SubProc, to be specific).
- J is declared at line 1, and used on lines 14, 13, and 7.
- KEPRESSED is used on line 15. The star before KEYPRESSED means that
the identifier does not belong to MAIN itself. <external> means that
the identifier does, indeed, not belong to the PROGRAM.
(in this case, it belongs to TURBO PASCAL's CRT unit).
- the procedure SUBPROC is called once, from line 15.
SUBPROC procedure [3-10]
VARS: *I [main:1]..................9,
X [4].......................9,9,*7,
Y [4].......................*7,
Z [4].......................
parts: EVENSMALLERPROC,
used : main........................15,
uses : evensmallerproc\subproc.....9,
This states that
- there is a procedure SUBPROC, spanning lines 3-10.
- It is used (acalled) once, from the main program, on line 15.
- It contains the declaration of a private procedure, EVENSMALLERPROC,
which it uses on line 9.
- It uses the variable I at line 9, and as we can see, this variable is
NOT a local variable, but a variable that has been declared on line 1
of the MAIN program.
- The variables X,Y and Z are declared on line 4. Z is never used.
Y is used once, on line 7, and the star shows that is is used from
within a sub-procedure. X is used twice on line 9, and (as part of a
subprocedure) once on line 7.
EVENSMALLERPROC procedure [5-7]
\subproc
VARS: I [5].......................7,
*J [main:1]..................7,
*X [subproc:4]...............7,
*Y [subproc:4]...............7,
Z [6].......................7,
used : subproc.....................9,
means that
- the function EVENSMALLERPROC spans lines 5-7, and is part of the
procedure SUBPROC. It is used once, from line 9 of subproc.
- It uses local variables I and Z, it uses external variables
X and Y (belonging to SUBPROC and both declared on line 4), and it
uses the external variable J which belongs to the main procedure
and has been declared on line 1.
Now, for the usage:
USAGE:
PX [filespec] [dumpfile] [options]
where
[filespec] is a (wildcarded) file specification.
It is optional, and if left out, "*.PAS" is assumed.
In that case, PX provides a file selection window.
[dumpfile] Is the destination. If left out, the output is
sent to the screen.
[options] may be any combination of the following:
/m - crossreference only MAIN and the MAIN procedures:
Sub-procedures are not cross-referenced. They
are only mentioned as PARTS of the procedures
in which they occur.
/c - do not crossreference USES/USED:
only the procedures and their line-numbers
are displayed.
/u - crossreference USES, not USED:
just show the procedures, and which other
procedures they call.
/v - also cross-reference variables.
/n - cross-reference variables, but only the
non-local variables.
/e - do not crossreference externals when
cross-referencing variables (such as KEYPRESSED).
So, suppose we would use
PX EXAMPLE.PAS DUMP /nmec
we would get only
MAIN program [1-16]
SUBPROC procedure [3-10]
VARS: *I [main:1]..................9,
parts: EVENSMALLERPROC,
i.e. EVENSMALLERPROC is not cross-references (because of the M-option),
KEYPRESSED is not mentioned (because of the E-option), procedures
calls are not cross-referenced (because of the C-option),
and non-local variables are mentioned (because of the N-option).
Customizing PX
==============
To the file PX.EXE belongs a file PX.DAT, in which the keywords of
PASCAL are described. These keywords will be excluded from the
cross-reference. Lines starting with a semi-colon ";" are ignored.
You can add other keywords to be excluded. However, before you adapt
this file to exclude too many keywords, remember that the /E-option
will prevent output of all externals anyway.
HISTORY
PX 1.0 - 20/05/89 : just showed procedures and their line-spans
PX 1.1 - 05/09/89 : added CALLS/CALLED cross reference
PX 1.2 - 29/10/89 : added variable cross reference
PX 1.4 - 19/05/91 : added file selection window and PX.DAT